[<<Previous Entry]
[^^Up^^]
[Next Entry>>]
[Menu]
[About The Guide]
V_TIMEOUT()
Advanced feature allows setting the internal lock timeout value
-------------------------------------------------------------------------------
Syntax
V_TIMEOUT( [<nTimeOut>] ) -> nOldSetting
Arguments
<nTimeOut> is the time interval (in seconds) before FlexFile will
abort a function that is attempting an internal lock. The default
value is forever.
Returns
V_TIMEOUT() returns the current timeout value.
Description
V_TIMEOUT() should not usually be necessary. If you are using
Clipper's RLOCK() and FLOCK() functions to manage the DBF file,
and you are keeping FlexFile's pointers in the DBF (this is the
preferred method), then this function is not necessary.
If you want FlexFile to timeout during an operation, then use this
function to set the timeout value in seconds. Passing zero as
<nTimeOut> will set the timeout value back to its default
(forever).
If you set the timeout to something other than zero, you must test
the error code following a call to any of the FlexFile functions
in the table below. The test is made by comparing V_ERROR() to
zero or 5200. If the operation's lock timed out, V_ERROR() will
return 5200, if the operation was successful, V_ERROR() will
return zero. (See the example below.)
Functions affected by V_TIMEOUT(): V_DELETE(), V_FILE2DBV(),
V_REPLACE(), V_STUFF(), V_DBV2FILE()
Examples
// Setup defines and variables
#define EXCLUSIVE_ (.T.)
LOCAL error_no
// Set the timeout to 3 seconds.
V_TIMEOUT(3)
// Open a DBF file and its related DBV file.
USE dbf_file
IF V_USE( "dbv_file", , , !EXCLUSIVE_ ) == -1
error_no = V_ERROR()
IF error_no == 5200
? "Attempt to lock header failed after 3 seconds"
RETURN .F.
ELSE
? "Error: " + str( error_no, 4 )
RETURN .F.
ENDIF
ENDIF
See Also:
V_USE()
V_REPLACE()
This page created by ng2html v1.05, the Norton guide to HTML conversion utility.
Written by Dave Pearson